-
Notifications
You must be signed in to change notification settings - Fork 17
Add sparse solvers to xobjects #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Adding this comment to document my environment setup for creating a cupy environment with all the dependencies for the sparse functionality. These instructions worked on AlmaLinux 9.6 with CUDA 13.0 installed and a V100 GPU. nvrtc no longer supports older architectures (Volta, Pascal) on CUDA 13.0, as such, we need to install an older cuda toolkit on older GPUs. Instructions given use micromamba, but conda works in the same way. Install cupy and cuda-toolkit: micromamba install -c conda-forge \
"cuda-toolkit=12.9" \
"cupy" \
-yAnd for cuDSS bindings: micromamba install nvmath-pythonIn the past, I had to manually install cuDSS using: micromamba install -c nvidia libcudss0 |
Description
This pull request adds sparse solvers to xobjects via the xo.sparse module. This functionality is important for extending xfields to include Finite Difference solvers.
The xo.sparse module can be used to solve sparse linear systems of equations:
A*x = b
where A is a sparse matrix.
Currently only CPU and Cupy contexts are supported. This module contains a variety of solvers for different contexts, with consistent APIs. The intended use is to reuse the same LHS for many solves, so the solvers work as follows:
solver(A) # Performs decomposition/factorization
solver.solve(b) # Solves Ax = b using precomputed factors
For optimal performance across backends b should be a column-major (F Contiguous) array or vector.
The intended interface for this module is:
xo.sparse.factorized_sparse_solver()
The above function includes detailed documentation for usage, but in short, it returns the best performing solver object based on the context and available modules. If the context is not explicitly defined, it is inferred based on the input matrix.
For development and convenience purposes the xo.sparse.solvers module is present, which provides the following aliases:
This pull request introduces new optional dependencies for xobjects:
nvmath-python: Provides the cuDSS bindings for fast solves on GPU
PyKLU: For fast LU solves on CPU (now published in pypi)
cuDSS needs to be installed in the conda environment and to be supported by the driver version (CUDA 12.0+)
Additional changes:
Checklist
Mandatory:
Optional: